package lab02.test24;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * Created by dell on 2017/10/30.
 */
public class Test {
    public static void main(String[] args) {
        class Test1 {
            public String getDate() {
                SimpleDateFormat ft = new SimpleDateFormat("yyyy/MM/dd");
                Date dd = new Date();
                return ft.format(dd);
            }
            public long getQuot(String time1, String time2) {
                long quot = 0;
                SimpleDateFormat ft = new SimpleDateFormat("yyyy/MM/dd");
                try {
                    Date date1 = ft.parse(time1);
                    Date date2 = ft.parse(time2);
                    quot = date1.getTime() - date2.getTime();
                    quot = quot / 1000 / 60 / 60 / 24;
                } catch (ParseException e) {
                    e.printStackTrace();
                }
                return quot;
            }
            public void main(String[] args) throws Exception {
                String date1 = "2008/8/8";
                String date2 = getDate();
                long day = getQuot(date1, date2);
                System.out.println("距离 " + date1 + " 还有 " + day + " 天");
            }
        }
        System.out.println("请输入时间");
    }
}